package com.yoda.mall.model.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageResult<T> implements Serializable {


    private Integer pageNum=1;//当前页

    private Integer pageSize=10;//每页显示数量

    private Integer totalPage=0;//总页数

    private Integer total=0;//总记录数

    private List<T> list;//数据

    public PageResult(Integer pageNum, Integer pageSize, Integer total, List<T> list) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.total = total;
        this.totalPage = total % pageSize == 0 ? total / pageSize : total / pageSize + 1;
        this.list = list;
    }

}
